import time
def  buble(a):
    ended = True
    while ended:
        ended = False
        for i in range(1, len(a)):
            if a[i] < a[i-1]:
                a[i], a[i-1] = a[i-1], a[i]
                ended = True

with open('a1_sorted.txt') as f:
    a1 = list(map(int, f.readlines()))
    t1 = time.time()
    buble(a1)
    t2 = time.time()
    print(t2-t1)

with open('a2_sorted.txt') as f:
    a2 = list(map(int, f.readlines()))
    t3 = time.time()
    buble(a2)
    t4 = time.time()
    print(t4-t3)

with open('a3_sorted.txt') as f:
    a3 = list(map(int, f.readlines()))
    t5 = time.time()
    buble(a3)
    t6 = time.time()
    print(t6-t5)
    
